//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/.
// 			VisualNovelToolkit		     /_/_/_/_/_/_/_/_/_/.
// Copyright ©2013 - Sol-tribe.	/_/_/_/_/_/_/_/_/_/.
//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/.
using UnityEngine;
using System.Collections;

namespace ViNoToolkit{

	/// <summary>
	/// System utility class.
	/// </summary>
	static public class SystemUtility {	

		static public string k_QuickSaveFileName = "QSaveData";
		
		/// <summary>
		/// Checks the quick save file and load from storage.
		/// </summary>
		/// <returns><c>true</c>, if quick save file and load from storage was checked, <c>false</c> otherwise.</returns>
		static public bool CheckQuickSaveFileAndLoadFromStorage(){		
			bool isQuickSaveFileExists = ExternalAccessor.IsSaveDataFileExists( k_QuickSaveFileName );
			if( isQuickSaveFileExists ){
				ScenarioCtrl sc = ScenarioCtrl.Instance;
				// Load SaveInfo from Storage.
				ViNo.LoadDataFromStorage( k_QuickSaveFileName , ref sc.quickSaveSlot);
			}
			else{
				Debug.LogWarning( "Quick Save File not exists." );
			}

			return isQuickSaveFileExists;
		}
		
		/// <summary>
		/// Shows the system U.
		/// </summary>
		/// <param name="t">If set to <c>true</c> t.</param>
		static public void ShowSystemUI( bool t = true ){
			SystemUIEvent sys = SystemUIEvent.Instance;
			if( sys != null ){
				sys.ShowSystemUI( t );
	/*			
				sys.ShowMenuBar( t );
				sys.ShowMenuButton( t );
				sys.ShowCurrentTextBox( t );
	//*/			
			}
			else{
				Debug.LogWarning( "SystemUIEvent not found." );
			}
		}
		
		/// <summary>
		/// Clears all text box message.
		/// </summary>
		static public void ClearAllTextBoxMessage(){
			SystemUIEvent sys = SystemUIEvent.Instance;		
			if( sys != null ){
				for( int i=0;i<sys.messageBoxes.Length;i++){
					sys.messageBoxes[ i ].ClearMessage();
				}
			}
			else{
				Debug.LogWarning( "SystemUIEvent not found." );
			}
		}
		
		/// <summary>
		/// Enables the collider current text box.
		/// </summary>
		/// <param name="enable">If set to <c>true</c> enable.</param>
		static public void EnableColliderCurrentTextBox( bool enable ){
			SystemUIEvent sys = SystemUIEvent.Instance;		
			if( sys != null ){
				sys.EnableColliderCurrentTextBox( enable );
			}
			else{
				Debug.LogWarning( "SystemUIEvent not found." );
			}
		}

	}
}
